package com.jeff.android.lab.util;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.jeff.android.lab.FragmentDependActivity;
import com.jeff.android.lab.android.immerse.ImmerseImageActivity;

/**
 * @author: duff
 * @date: 2019/1/7
 * @since: 1.0.0
 */
public class RouterUtil {

    public static void launchActivity(Context context, Class<?> clazz) {
        Intent intent = new Intent(context, clazz);
        context.startActivity(intent);
    }

    public static void launchFragmentActivity(Context context, Class clazz) {
        launchFragmentActivity(context, clazz, null);
    }

    /**
     * @param context
     * @param clazz    Fragment 类
     * @param bundle   Fragment 传递数据
     */
    public static void launchFragmentActivity(Context context, Class clazz, Bundle bundle) {
        Intent intent = new Intent(context, FragmentDependActivity.class);
        intent.putExtra(FragmentDependActivity.EXTRA_CLASS, clazz);
        if (bundle != null)
            intent.putExtra(FragmentDependActivity.EXTRA_BUNDLE, bundle);
        context.startActivity(intent);
    }

}
